﻿/**
* @file hal_seven_seg_led .c
* @brief this is a brief description
* @details this is the detail description.
* @author fulong 
* @data 2014/10/11
* @version 1.0
* @par Copyright (c):
* @par First build
*     version: fulong 
*     data: 2014/10/11
*/
#include "hal_seven_seg_led.h"
#include "../dev/display/seven_seg_led.h"
#include <string.h>
#include "../dev/uart.h"

#ifdef __SIMPLE_DISPLAY__
static uint8 dis_location = 0;
static uint8 pre_dis_location = 0;
static uint8 display_buff[LED_SEG_MAX] = { 0 };

void hal_seven_seg_display(void)
{
    //数码管消影
    seven_seg_display(pre_dis_location, display_buff, 0xFF);
    seven_seg_display(dis_location, display_buff, dis_location);
    pre_dis_location = dis_location;
    dis_location++;
    dis_location %= LED_SEG_GCM;
}
void hal_display_word(const uint8 x, const uint8 y, const uint8 *word)
{
    uint8 i;
    uint8 len = strlen((const char *)word);
    if (len > (LED_SEG_MAX - x))
    {
        return;
    }
    for (i = 0; i < len; i++)
    {
        display_buff[LED_SEG_MAX - x - i - 1] = word[i];
    }
}
void hal_screen_clr_location(const uint8 x, const uint8 y, const uint8 len)
{
    uint8 i;
    if ((x + len) > LED_SEG_MAX)
    {
        return;
    }
    for (i = 0; i < len; i++)
    {
        display_buff[LED_SEG_MAX - x - i - 1] = 0;
    }
}
void hal_screen_clr(void)
{
    uint8 i;
    for (i = 0; i < LED_SEG_MAX; i++)
    {
        display_buff[i] = 0;
    }
}
#endif
